package model.tokens;

import java.util.Deque;
import java.util.Queue;

import model.semantics.Node;

import model.parser.FunctionDefinition;
import model.parser.FunctionTable;
import model.parser.ParserException;

/**
 * A functional tokens
 */

public abstract class FunctionalToken<T> extends NodeToken<T> {
    protected FunctionDefinition<T> myFunctionDefinition;
    private FunctionTable<T> myFunctionTable;

    public FunctionTable<T> getFunctionTable() {
        return myFunctionTable;
    }

    public int getOrder() {
        return myFunctionDefinition.order;
    }

    public int getPrecedence() {
        return myFunctionDefinition.precedence;
    }

    public FunctionalToken(TokenConstructorArguments<T> args) {
        super(args);
        myFunctionDefinition = args.functionTable.getDefinition(args.symbol);
    }

    public abstract Node<T> makeNewInstance(Deque<Node<T>> queue);
}
